/*+ysJHoDYoDx5ydze45LdSvmRtkfkjP2ioha4fUmVNWI0lyiZZn2FySKYqnLYi6iY*/
/*+ysJHoDYoDx5ydze45LdStEE8zwoUOGe4xprNQS3Eyg=*/
/*
 * @Author: zhaochyu
 * @PageInfo: 联查采购计划
 * @Date: 2020-02-27 12:23:31
 * @Last Modified by: zhaochyu
 * @Last Modified time: 2020-03-05 13:27:52
 */
import { toast, ajax } from "nc-lightapp-front";
import { PAGECODE, URL, FIELD } from "../../constance";
import { getLangByResId } from "../../../../../scmpub/scmpub/pub/tool/multiLangUtil";
export default function linkSharePoPlanBtnClick(props) {
  console.log(this.sharecheckrow,"resssss")
  debugger;
  let selectedRow = props.cardTable.getCheckedRows('list_head');
  if (selectedRow == null || selectedRow.length == 0) {
    alert(123);
  // if (this.sharecheckrow == null || this.sharecheckrow == -1) {
    toast({
      color: "warning",
      content: getLangByResId(
        this,
        "4004POORDER-000051"
      ) /* 国际化处理： 请选择行！*/
    });
    return;
  }
   // console.log(selectedRow,"resssss111")
  // zhangh 分摊表体采购组织
  let pk_orgs = [];
  for (let i = 0; i < selectedRow.length; i++) {  
    let pk_org = props.cardTable.getValByKeyAndIndex('list_head', selectedRow[i].index, 'pk_org').value;
    pk_orgs.push(pk_org);
  }
  
  // zhangh采购组织
  // let pk_org = props.cardTable.getValByKeyAndIndex('list_head', this.sharecheckrow, 'pk_org').value;
  // console.log(pk_org,"resssss")
  // 表头采购组织
   let pk_order = props.form.getFormItemsValue(PAGECODE.cardhead, FIELD.pk_order).value;
  if (pk_order) {
    let conditionData = {
      pks: [pk_order],
      pk_org:pk_orgs,
      pageid: PAGECODE.cardcode
    };
    ajax({
      url: URL.linpayplay,
      data: conditionData,
      method: "POST",
      success: res => {
        if (res.data) {
          this.setState({
            showNtbDetail: true,
            ntbdata: res.data
          });
        }
      }
    });
  }
}

/*+ysJHoDYoDx5ydze45LdStEE8zwoUOGe4xprNQS3Eyg=*/
/*+ysJHoDYoDx5ydze45LdSvmRtkfkjP2ioha4fUmVNWI0lyiZZn2FySKYqnLYi6iY*/